<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // ES6 允许按照一定模式从数组和对象中提取值,对边量进行赋值
        // 这被称为结构赋值

        //1.数组的结构
        // const f4 = ['小沈阳', '刘能', '赵四', '宋小宝'];
        // let [xiao, liu, zhao, song] = f4;
        // console.log(xiao);
        // console.log(liu);
        // console.log(zhao);
        // console.log(song);

        //2.对象的解构
        const zhao = {
            name: '赵本山',
            age: '不详',
            xiaopin: function() {
                console.log('我可以演小品');
            }
        };

        // let {
        //     name,
        //     age,
        //     xiaopin
        // } = zhao;
        // console.log(name);
        // console.log(age);
        // console.log(xiaopin);
        // xiaopin();

        let {
            xiaopin
        } = zhao;
        xiaopin();

        //相当于 zhao.xiaopin(); 替换成了 xiaopin();
        //不用重复书写zhao.
    </script>
</body>

</html>